//
//  WBBaseViewController.swift
//  Swift_weiboDemo
//
//  Created by toro宇 on 2017/5/9.
//  Copyright © 2017年 toro宇. All rights reserved.
//

import UIKit

class WBBaseViewController: UIViewController {

    // 自定义导航
    lazy var navigationBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: UIScreen.yy_screenWidth(), height: 64))
    lazy var  navItem = UINavigationItem()
    
   
    override func viewDidLoad() {
        super.viewDidLoad()
        setUpUI()
        // Do any additional setup after loading the view.
    }
    override var title: String?{
        didSet{
            navItem.title = title
        }
    }
}

// MARK: - 方法规整
extension WBBaseViewController{

        func setUpUI(){
        view.backgroundColor = UIColor.cz_random()
        
        view.addSubview(navigationBar)
        navigationBar.items = [navItem]
        // 设置 navBar 的背景颜色
        navigationBar.barTintColor = UIColor(hex: "F6F6F6")
        
        // 设置 navBar的字体颜色
            navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.gray]
    }
    
}
